Degrees of Relationship Types

In this lesson, we will learn about the different degrees of relationship types.

Degrees of relationship types#

Consider the scenario where an employee works on multiple projects, so for a single EMPLOYEE entity the number of PROJECT entities he/she is associated with is multiple. Similarly, a PROJECT entity can have multiple EMPLOYEE entities that work on it. We represent this situation in our ER model through the degrees of a relationship.

The degree of a relationship type is the number of participating entities types. We will focus on mainly three types of degrees:

The Unary (recursive) relationship type#

The unary relationship type involves only one entity type. However, the same entity type participates in the relationship type in different roles. For example, The SUPERVISES relationship type relates an employee to a supervisor, where both employee and supervisor entities are members of the same EMPLOYEE entity set. Hence, the EMPLOYEE entity type participates twice in SUPERVISION: once in the role of supervisor, and once in the role of the supervisee. This concept is illustrated below:

svg viewer
Unary (Recursive) Relationship Type

Each relationship instance ri_i in SUPERVISES associates two different employee entities ej_j and ek_k, one of which plays the role of supervisor and the other the role of the supervisee. In the figure above, the dotted lines represent the supervisor role, and the solid lines represent the supervisee role; hence, e1_1 supervises e4_4 and e6_6, e7_7 supervises e3_3 and e2_2.

In the case of ER diagram we represent unary relationship types as:

svg viewer

The Binary relationship type#

This relationship type has two entity types linked together. This is the most common relationship type. For example, consider a relationship type WORKS_ON between the two entity types EMPLOYEE and PROJECT, which associates each employee with the project he/she is working on. This relationship is expanded upon in the diagram below:

svg viewer
Binary Relationship Type

In the figure above each relationship instance ri_i is shown connected to the EMPLOYEE and PROJECT entities that participate in ri_i. In the mini-world represented by this figure, the employees e1_1 and e3_3 work on project p1_1, the employee e2_2 works on project p2_2, and so on.

In the case of ER diagram we represent the binary relationship type as:

svg viewer

The Ternary relationship type#

If there are three entity types linked together, the relationship is called a ternary relationship. An example of a ternary relationship is SUPPLY, shown in the figure below, where each relationship instance ri_i associates three entities—a supplier s, a part p, and a project j.

svg viewer
Ternary Relationship Type

In the above diagram, we observe that a supplier si_i supplies part pj_j to a project jkj_k. So we see that the supplier s1_1 supplies part p1p_1 to both projects j1j_1 and j2j_2, while also supplying p2p_2 to project j1j_1. Similarly, other relationships can be determined as well.

In the case of an ER diagram we represent ternary relationship type as:

svg viewer

In the next lesson, we will discuss the constraints on binary relationship types.

Relationships, Relationship Sets and Relationship Types
Binary Relationship Type Constraints
Mark as Completed
Report an Issue